if(!BXHotKeys){function CBXHotKeys(){var _this=this;var idxKS=0;var idxCode=1;var idxCodeId=2;var idxName=3;var idxHKId=4;var arServSymb={8:"Back Space",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"Caps Lock",27:"ESC",32:"Space bar",33:"Page Up",34:"Page Down",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Delete",96:"0 (ext)",97:"1 (ext)",98:"2 (ext)",99:"3 (ext)",100:"4 (ext)",101:"5 (ext)",102:"6 (ext)",105:"9 (ext)",106:"* (ext)",107:"+ (ext)",104:"8 (ext)",103:"7 (ext)",110:". (ext)",111:"/ (ext)",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Num Lock",186:";",188:",",190:".",191:"/",192:"`",219:"[",220:"|",221:"]",222:"'",189:"-",187:"+",145:"Scrol Lock"};var bxHotKeyCode=0;var inputKeyCode=0;var inputDopString="";this.ArrHKCode=[];this.MesNotAssign="";this.MesClToChange="";this.MesClean="";this.MesBusy="";this.MesClose="";this.MesSettings="";this.MesDefault="";this.MesDelAll="";this.MesDelete="";this.MesDelConfirm="";this.MesDefaultConfirm="";this.MesExport="";this.MesExpFalse="";this.MesImport="";this.MesImpFalse="";this.MesImpSuc="";this.MesImpHeader="";this.MesFileEmpty="";this.MesChooseFile="";this.uid="";this.deleting=false;this.keyStrokes={};this.keyStrokesInit=false;this.Init=function(){this.Register()};this.UpdateKS=function(t,e){for(var i=0;i<this.ArrHKCode.length;i++){if(this.ArrHKCode[i][idxCodeId]==t){this.ArrHKCode[i][idxKS]=e;this.keyStrokesInit=false;return true}}};this.UpdateHk=function(t,e){for(var i=0;i<this.ArrHKCode.length;i++){if(this.ArrHKCode[i][idxCodeId]==t){this.ArrHKCode[i][idxHKId]=e;return i}}return-1};this.Add=function(t,e,i,s,n){for(var o=0;o<this.ArrHKCode.length;o++)if(this.ArrHKCode[o][idxCodeId]==i)return false;this.keyStrokesInit=false;return this.ArrHKCode.push([String(t),String(e),i,String(s),n])};this.GetExCode=function(t){var e="";if(t){if(this.keyStrokesInit==false){this.keyStrokes={};this.keyStrokesInit=true;for(var i=0;i<this.ArrHKCode.length;i++){var s=this.ArrHKCode[i][idxKS];if(s!=""){if(!this.keyStrokes[s]){this.keyStrokes[s]=""}else{this.keyStrokes[s]+=" "}this.keyStrokes[s]+=this.ArrHKCode[i][idxCode]}}}if(this.keyStrokes[t]){e=this.keyStrokes[t]}}return e};this.MakeKeyString=function(t){this.inputDopString=(t.ctrlKey?"Ctrl+":"")+(t.altKey?"Alt+":"")+(t.shiftKey?"Shift+":"");this.inputKeyCode=t.keyCode;if(!this.inputKeyCode)this.inputKeyCode=t.charCode;return this.inputDopString+this.inputKeyCode};this.ShowMenu=function(){return'<table class="bx-hk-settings-toolbar" cellspacing="0" cellpadding="0" border="0">'+'<tr><td class="bx-left"><div class="bx-hk-settings-empty"></div></td>'+'<td class="bx-content">'+'<a class="bx-context-button" hidefocus="true" href="javascript:void(0)" onclick="BXHotKeys.Import();">'+'<span class="bx-context-button-icon btn-import"></span>'+'<span class="bx-context-button-text">'+this.MesImport+"</span>"+"</a>"+'<a class="bx-context-button" hidefocus="true" href="javascript:void(0)" onclick="BXHotKeys.Export();">'+'<span class="bx-context-button-icon btn-export"></span>'+'<span class="bx-context-button-text">'+this.MesExport+"</span>"+"</a>"+'<a class="bx-context-button" hidefocus="true" href="javascript:void(0)" onclick="if(confirm(BXHotKeys.MesDelConfirm)) BXHotKeys.DelAll();">'+'<span class="bx-context-button-icon btn-delall"></span>'+'<span class="bx-context-button-text">'+this.MesDelAll+"</span>"+"</a>"+'<a class="bx-context-button" hidefocus="true" href="javascript:void(0)" onclick="if(confirm(BXHotKeys.MesDefaultConfirm)) { BXHotKeys.DelAll(); BXHotKeys.SetDefault(); }">'+'<span class="bx-context-button-icon btn-default"></span>'+'<span class="bx-context-button-text">'+this.MesDefault+"</span>"+"</a></td>"+'<td class="bx-right"><div class="bx-hk-settings-empty"></div></td></tr>'+"</table>"};this.ShowSettings=function(){var t='<table width="100%" id="tbl_hk_settings">';var e="";var i="";for(var s=0;s<this.ArrHKCode.length;s++){if(this.ArrHKCode[s][idxKS])e=this.PrintKSAsChar(this.ArrHKCode[s][idxKS]);else e=this.MesNotAssign;if(this.ArrHKCode[s][idxCode])i="<td width='30%' id='hotkeys-float-form-"+this.ArrHKCode[s][idxCodeId]+"'><a href='javascript:void(0)' onclick='BXHotKeys.SubstInput("+this.ArrHKCode[s][idxCodeId]+", "+this.ArrHKCode[s][idxHKId]+', "'+this.ArrHKCode[s][idxKS]+"\");' title='"+this.MesClToChange+"' class='bx-hk-settings'>"+e+"</a></td><td width='10%' align='right' id='hotkeys-float-form-del-"+this.ArrHKCode[s][idxCodeId]+"'><a href='javascript:void(0)' onclick='BXHotKeys.DeleteBase("+this.ArrHKCode[s][idxCodeId]+","+this.ArrHKCode[s][idxHKId]+");' class='hk-delete-icon' title='"+this.MesDelete+"'></a></td>";else i="<td width='30%'>&nbsp;</td><td width='10%'>&nbsp</td>";t+="<tr class = 'bx-hk-settings-row'><td width='60%'>"+this.ArrHKCode[s][idxName]+"</td>"+i+"</tr>"}t+="</table>";var n=new BX.CWindowButton({title:this.MesClose,action:function(){this.parentWindow.Close()}});var o=new BX.CDialog({title:this.MesSettings,content:t,buttons:[n],width:500,height:400,resizable:false});this.tblSettParent=BX("tbl_hk_settings").parentNode;BX.addCustomEvent(o,"onWindowClose",function(t){t.DIV.parentNode.removeChild(t.DIV);_this.Register()});var r=document.createElement("div");r.className="bx-hk-settings-toolbar";r.innerHTML=this.ShowMenu();var a=BX.findChild(o.DIV,{attribute:{"class":"bx-core-adm-dialog-content"}},true);if(a){a.appendChild(r);BX.findChild(o.DIV,{attribute:{"class":"bx-core-adm-dialog-content"}},true).style.marginTop="37px"}else{this.hk_getElementsByClass("bx-core-adm-dialog-head")[0].appendChild(r);this.hk_getElementsByClass("bx-hk-settings-toolbar",o.DIV,"div")[0].style.width="480px"}o.Show();this.Unregister()};this.hk_getElementsByClass=function(t,e,i){e=e||document;i=i||"*";var s=e.getElementsByTagName(i),n=s.length,o=[],r;for(r=0;r<n;r++){if(s[r].className==t){o.push(s[r]);break}}return o};this.DelAll=function(){_this.deleting=true;for(var t=0;t<this.ArrHKCode.length;t++){_this.UpdateKS(this.ArrHKCode[t][idxCodeId],"");_this.UpdateHk(this.ArrHKCode[t][idxCodeId],0);_this.SubstAnch(this.ArrHKCode[t][idxCodeId],0,"");_this.SubstDel(this.ArrHKCode[t][idxCodeId],0)}var e=new JCHttpRequest;var i="/bitrix/admin/hot_keys_act.php?hkaction=delete_all";var s="&sessid="+phpVars.bitrix_sessid;e.Action=function(t){_this.deleting=false};e.Post(i,s)};this.Register=function(){try{jsUtils.addEvent(document,"keypress",_this.KeyPressHandler);jsUtils.addEvent(document,"keydown",_this.KeyDownHandler)}catch(t){}};this.Unregister=function(){jsUtils.removeEvent(document,"keypress",_this.KeyPressHandler);jsUtils.removeEvent(document,"keydown",_this.KeyDownHandler)};this.SetDefault=function(){var t=new JCHttpRequest;var e="/bitrix/admin/hot_keys_act.php?hkaction=set_default";var i="&sessid="+phpVars.bitrix_sessid;t.Action=function(t){if(t){if(!t)return false;var e=[];var i="";var s=t.split(";;");for(var n=0;n<s.length;n++){e=s[n].split("::");i=_this.UpdateHk(e[0],e[1]);if(i>=0){_this.UpdateKS(e[0],e[2]);_this.SubstAnch(e[0],e[1],e[2]);_this.SubstDel(e[0],e[1])}}}};waiter={func:function(){if(!this.deleting){t.Post(e,i);clearInterval(intervalID)}}};intervalID=window.setInterval(function(){waiter.func.call(waiter)},1e3)};this.IsKeysBusy=function(t,e){for(var i=0;i<this.ArrHKCode.length;i++)if(this.ArrHKCode[i][idxKS]==t&&this.ArrHKCode[i][idxCodeId]!=e)return true;return false};this.SubstInput=function(t,e,i){var s=document.getElementById("hotkeys-float-form-"+t);if(!s)return false;s.innerHTML="";s.innerHTML='<input type="text" class="adm-input" name="HUMAN_KEYS_STRING" size="10" maxlength="30" value="'+this.PrintKSAsChar(i)+'" id="HKeysString" autocomplete="off">'+'<input type="hidden" name="KEYS_STRING" value="'+i+'" id="KeysString">';var n=document.getElementById("HKeysString");var o=document.getElementById("KeysString");n.onkeydown=_this.SetInput;n.onkeypress=_this.SetInput;n.onkeyup=function(){ShowWaitWindow();n.onblur="";if(_this.IsKeysBusy(o.value,t))if(!confirm(_this.MesBusy)){_this.SubstAnch(t,e,i);return false}_this.bxHotKeyCode=0;_this.UpdateKS(t,o.value);if(e){_this.UpdateHk(t,e);_this.UpdateBase(e,o.value)}else _this.AddBase(t,o.value);_this.SubstAnch(t,e,o.value);CloseWaitWindow()};n.focus();n.onblur=function(){_this.SubstAnch(t,e,i)}};this.SubstAnch=function(t,e,i){var s=document.getElementById("hotkeys-float-form-"+t);if(s)s.innerHTML="<a href='javascript:void(0)' onclick='BXHotKeys.SubstInput("+t+", "+e+', "'+i+"\");' title='"+this.MesClToChange+"' class='bx-hk-settings'>"+(i?this.PrintKSAsChar(i):this.MesNotAssign)+"</a>"};this.SubstDel=function(t,e){var i=document.getElementById("hotkeys-float-form-del-"+t);if(i)i.innerHTML="<a href='javascript:void(0)' onclick='BXHotKeys.DeleteBase("+t+","+e+");' class='hk-delete-icon' title='"+this.MesDelete+"'></a>"};this.AddBase=function(t,e){var i=new JCHttpRequest;var s="/bitrix/admin/hot_keys_act.php?hkaction=add";var n="&KEYS_STRING="+encodeURIComponent(e)+"&CODE_ID="+t+"&USER_ID="+_this.uid+"&sessid="+phpVars.bitrix_sessid;i.Action=function(i){if(i&&i==Number(i)){var s=_this.UpdateHk(t,i);if(s>=0){_this.SubstAnch(t,i,e);_this.SubstDel(t,i)}}};i.Post(s,n)};this.Export=function(){window.open("/bitrix/admin/hot_keys_act.php?hkaction=export&sessid="+phpVars.bitrix_sessid)};this.OnFileInputChange=function(t){fileName=t.value;fileName=fileName.replace(/\\/g,"/");fileName=fileName.substr(fileName.lastIndexOf("/")+1);if(t.parentNode.childNodes[0].textContent)t.parentNode.childNodes[0].textContent=fileName;else t.parentNode.childNodes[0].innerText=fileName};this.Import=function(){var t='<form action="/bitrix/admin/hot_keys_act.php?hkaction=import" method="post" enctype="multipart/form-data" target="upload_iframe" id="hk_import_form" name="hk_import_form">'+'<input type="hidden" name="sessid" value="'+BX.bitrix_sessid()+'">'+'<span class="adm-input-file"><span>'+this.MesChooseFile+'</span><input type="file" name="bx_hk_filename" id="bx_hk_filename" class="adm-designed-file" onchange="BXHotKeys.OnFileInputChange(this);"></span>'+"</form>"+'<iframe id="upload_iframe" name="upload_iframe" style="display:none"></iframe>';var e=new BX.CWindowButton({title:this.MesClose,action:function(){this.parentWindow.Close()}});var i=new BX.CWindowButton({title:this.MesImport,action:function(){if(!BX("bx_hk_filename").value){alert(_this.MesFileEmpty);return}BX("hk_import_form").submit();ShowWaitWindow()}});var s=new BX.CDialog({title:this.MesImpHeader,content:t,buttons:[i,e],width:300,height:60,resizable:false});s.Show()};this.OnImportResponse=function(t){if(t)alert(_this.MesImpSuc+t);else alert(_this.MesImpFalse);BX.reload()};this.UpdateBase=function(t,e){var i=new JCHttpRequest;var s="/bitrix/admin/hot_keys_act.php?hkaction=update";var n="&KEYS_STRING="+encodeURIComponent(e)+"&ID="+t+"&sessid="+phpVars.bitrix_sessid;i.Post(s,n)};this.DeleteBase=function(t,e){if(e){var i=new JCHttpRequest;var s="/bitrix/admin/hot_keys_act.php?hkaction=delete";var n="&ID="+e+"&sessid="+phpVars.bitrix_sessid;i.Post(s,n);_this.UpdateKS(t,"");_this.UpdateHk(t,0);_this.SubstAnch(t,0,"");_this.SubstDel(t,0)}};this.PrintKSAsChar=function(t){if(!t)return"";var e=t.lastIndexOf("+");if(e){var i=t.substr(e+1,t.length-(e+1));var s=t.substr(0,e+1);if(i==16||i==17||i==18)return s.substr(0,s.length-1)}else{i=t;s=""}var n=arServSymb[i];if(!n)n=String.fromCharCode(i);return s+n};this.SetInput=function(t){t=t||event;var e=(t.ctrlKey?"Ctrl+":"")+(t.altKey?"Alt+":"")+(t.shiftKey?"Shift+":"");if(t.keyCode&&t.type!="keypress")_this.bxHotKeyCode=t.keyCode;var i;if(t.charCode==undefined)i=t.which;else i=t.charCode;if(i&&(!_this.bxHotKeyCode||_this.bxHotKeyCode==17||_this.bxHotKeyCode==18||_this.bxHotKeyCode==16||_this.bxHotKeyCode==224))_this.bxHotKeyCode=i;document.getElementById("KeysString").value=e+_this.bxHotKeyCode;document.getElementById("HKeysString").value=_this.PrintKSAsChar(document.getElementById("KeysString").value);return false};this.KeyPressHandler=function(e){e=e||event;if(e.charCode>256){var ExCode=_this.GetExCode(_this.MakeKeyString(e));if(ExCode)eval(ExCode)}};this.KeyDownHandler=function(e){e=e||event;var ExCode=_this.GetExCode(_this.MakeKeyString(e));if(ExCode)eval(ExCode)}}var BXHotKeys=new CBXHotKeys;BXHotKeys.Init();window.BXHotKeys=BXHotKeys}
//# sourceMappingURL=hot_keys.map.js